﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfForumInfo1.aspx.cs" Inherits="msBsc.WebUi.wMall.Public.wfForumInfo1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>推荐详情</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/menu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/pagination.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sForumInfo.css" rel="stylesheet" />
</head>
<body>
    <div class="wf_all">
        <input type="hidden" id="forumId" />
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container" style="border: 0 none;">
            <div class="main-Info" style="width: 1000px;">
                <%-- <div class="main-menu" style="width:1000px;">
                    <ul class="breadcrumb" style="width:880px;">
                        <li>
                            <a href="/">首页</a>
                            <span class="divider">></span>
                        </li>
                        <li>
                            <a href="/wp_ForumList.htm" id="menuParent">论坛</a>
                            <span class="divider">></span>
                        </li>
                        <li class="" id="menuName">论坛详情</li>
                    </ul>
                    <a href="/ws_ReleaseForum.htm" class="Release">+ 发布</a>
                    <div class="clear"></div>
                </div>--%>
                <div class="main-horizontal" style="width: 1000px;">
                    <div class="formList">
                        <div>
                            <div class="releasePeople">
                                <div class="pInfo">
                                    <div class="releasePimg">
                                        <a target="_blank" href="#" id="pfhrefImg">
                                            <img id="pfImg" /></a>
                                    </div>
                                    <div class="releaseName"><a id="pfName" target="_blank" href="#" style="color: #3992dd;"></a></div>
                                </div>
                            </div>
                            <div class="releaseInfo">
                                <div class="forumTitle" id="pfTitle">
                                </div>
                                <div class="releaseContent" id="pfContent">
                                </div>
                                <div class="releaseTime">
                                    <span data-value="" id="pfReplyId" class="replyClick">回复</span>
                                    <span id="pfTime"></span>
                                </div>
                                <div class="reply">
                                    <div>
                                        <textarea name="content" class="replyTxt"></textarea>
                                    </div>
                                    <div class="r_button">
                                        <input type="button" onclick="reply(this)" value="回复评论" />
                                        <input type="button" onclick="cancelReply()" value="取消" />
                                    </div>
                                </div>

                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="replyListInfo">
                            <ol id="replyInfo">
                            </ol>
                        </div>
                    </div>
                    <div class="jpage" id="divPage"></div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>
        <script src="/themes/wStyle1/js/comm/jsPagination.js"></script>
        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
        <!--end JS引用-->
        <script type="text/javascript">
            var replyId = "";
            (function () {
                $("#forumId").val(GetQueryStr("forumId"));
                //回复按钮
                $(".replyClick").live("click", function () {
                    $(".reply").hide();
                    $(".replyTxt").val("");
                    $(this).parent(".releaseTime").next(".reply").show();
                    replyId = $(this).attr("data-value");
                });
            })()

            var pIndex = 1;
            var pageSize = 5;
            function btnDo(sEbtn) {
                GtGrid1Action = sEbtn;
                var opart = new jsonRow();
                opart.AddCell("forumId", $("#forumId").val());
                opart.AddCell("pIndex", pIndex);
                opart.AddCell("pRows", pageSize);
                opart.AddCell("ACTION", GtGrid1Action);
                ajaxComm(opart);
            };

            //执行AJAX调用时获取参数
            function GetGtParam() {
                var _jsParam = new jsonRow();
                _jsParam.AddCell("pIndex", pIndex);
                _jsParam.AddCell("pRows", pageSize);
                _jsParam.AddCell("ACTION", GtGrid1Action);
                return _jsParam;
            };

            function goPage(Index) {
                pIndex = Index;
                btnDo("getReply");
            }

            btnDo("init");

            function doBoundContent(_shopurl) {
                if (_shopurl != null && _shopurl != undefined && _shopurl != '') {
                    jQuery.loadHtml(_shopurl).done(function (_rethtml) {
                        var tpl = HtmlUtil.htmlDecode(_rethtml);
                        $("#pfContent").html(tpl);
                    });
                }
            };

            function setForumInfo(data) {
                $("#pfImg").attr("src", data.rows[0].CUSTOMER_DEFAULT_PIC + " 106x106img.jpg");
                $("#pfName").text(data.rows[0].CUSTOMER_NICK);
                $("#pfName").attr("href", "/wp_DjackInfo.htm?djackId=" + data.rows[0].POSTS_PUBLISH_BY);
                $("#pfhrefImg").attr("href", "/wp_DjackInfo.htm?djackId=" + data.rows[0].POSTS_PUBLISH_BY);
                $("#pfTitle").text(data.rows[0].SOURCE_POSTS_TITLE);
                //$("#pfContent").html(data.rows[0].POSTS_CONTENT);
                doBoundContent(data.rows[0].CONTENT_HTML_URL)
                $("#pfTime").text(data.rows[0].POSTS_PUBLISH_TIME);
                $("#pfReplyId").attr("data-value", data.rows[0].SOURCE_POSTS_ID);
            }

            /*
                * 回复帖子
                * 
            */
            function reply(button) {
                var replyInfo = $(button).parents(".reply").find(".replyTxt").val();
                if (IsNull(replyInfo)) {
                    alert("请输入回复内容");
                    return;
                }
                if (IsNull(replyId)) {
                    alert("请选择回复对象");
                    return;
                }
                var opart = new jsonRow();
                opart.AddCell("replyInfo", replyInfo);
                opart.AddCell("replyId", replyId);
                opart.AddCell("pIndex", pIndex);
                opart.AddCell("pRows", pageSize);
                opart.AddCell("forumId", $("#forumId").val());
                opart.AddCell("ACTION", "reply");
                ajaxComm(opart);
            }
            var rHtml = "";//回复html
            var fistTemp = "<li><div class='releasePeople reviewPeople'><div class='pInfo'><div class='releasePimg reviewPimg'><a target='_blank' ><img title='$replyByName$' src='$replyByImg$' /></a></div></div></div><div class='releaseInfo reviewInfo'><div class='releaseContent'><a target='_blank'  class='replyName'>$replyPeople$</a>：$replyContent$</div><div class='releaseTime'><span data-value='$thisId$' class='replyClick'>回复</span><span>$replyTime$</span></div><div class='reply'><div><textarea name='content' class='replyTxt'></textarea></div><div class='r_button'><input type='button' onclick='reply(this)' value='回复评论' /><input type='button' onclick='cancelReply()' value='取消' /></div></div><ol>";

            var noFistTemp = "<li><div class='releasePeople reviewPeople'><div class='pInfo'><div class='releasePimg reviewPimg'><a target='_blank' ><img title='$replyByName$' src='$replyByImg$' /></a></div></div></div> <div class='releaseInfo hthreeInfo'><div class='releaseContent'><a target='_blank'  class='replyName'>$replyPeople$</a>回复<a target='_blank' class='replyName'>$publisherPeople$</a>：$replyContent$</div><div class='releaseTime'><span data-value='$thisId$' class='replyClick'>回复</span><span>$replyTime$</span></div><div class='reply'><div><textarea name='content' class='replyTxt'></textarea></div><div class='r_button'><input type='button' onclick='reply(this)' value='回复评论' /><input type='button' onclick='cancelReply()' value='取消' /></div></div></div><div class='clear'></div></li>"

            function setReplyList(data, parentId) {
                $("#replyInfo").html("");
                rHtml = "";
                $("#replyInfo").html(showReplyListHtml(data.rows, parentId, true));
            }

            //
            function showReplyListHtml(dataList, parentId, isFirst) {
                if (IsNull(dataList)) {
                    return "";
                }
                var count = 0;
                for (var i = 0; i < dataList.length; i++) {
                    count++;
                    if (dataList[i].RECOVER_TO_POSTS == parentId) {
                        var html = "";
                        if (isFirst) {
                            if (!IsNull(rHtml)) {
                                rHtml += "</ol></div><div class='clear'></div></li>";
                            }
                            html = fistTemp;
                        } else {
                            html = noFistTemp;
                        }
                        var recoverNickName = IsNull(dataList[i].RecoverNickName) ? "" : dataList[i].RecoverNickName;
                        var recoverToNickName = IsNull(dataList[i].RecoverToNickName) ? "" : dataList[i].RecoverToNickName;
                        html = html.replace("$replyByImg$", dataList[i].CUSTOMER_DEFAULT_PIC + " 46x46img.jpg");
                        html = html.replace("$replyByUrl$", "/wp_DjackInfo.htm?djackId=" + dataList[i].RECOVER_BY_ID);
                        html = html.replace("$replyPeopleUrl$", "/wp_DjackInfo.htm?djackId=" + dataList[i].RECOVER_BY_ID);
                        html = html.replace("$publisherPeopleUrl$", "/wp_DjackInfo.htm?djackId=" + dataList[i].BE_RECOVER_ID);
                        html = html.replace("$replyByName$", dataList[i].RECOVER_BY_PERSON);
                        html = html.replace("$replyPeople$", dataList[i].RECOVER_BY_PERSON);
                        html = html.replace("$publisherPeople$", dataList[i].BE_RECOVER_NICK);
                        html = html.replace("$replyContent$", dataList[i].REVOCER_CONTENT);
                        html = html.replace("$thisId$", dataList[i].RECOVER_POSTS_ID);
                        html = html.replace("$replyTime$", dataList[i].REVOCER_TIME);
                        rHtml += html;
                        showReplyListHtml(dataList, dataList[i].RECOVER_POSTS_ID, false);
                    }
                }
                if (isFirst && !IsNull(rHtml)) {
                    rHtml += "</ol></div><div class='clear'></div></li>";
                }
                if (count == dataList.length) {

                    return rHtml;
                }
            }

            /*
         * 取消回复
        */
            function cancelReply() {
                $(".reply").hide();
                $(".replyTxt").val("");
                replyId = "";
            }
        </script>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
</body>
</html>
